# Contributor:...

pkgname=oscam-svn
pkgver=3047
pkgrel=1
pkgdesc="OSCam: Open Source Cam"
arch=('i686' 'x86_64')
url="http://streamboard.gmc.to/svn/oscam/"
license=('unknown')
depends=('openssl')
makedepends=('cmake')
options=('emptydirs')
install=oscam.install
source=(
        rc-oscam
        oscam.install
        )
md5sums=('3f0909b06c3a92bb72239e9ea072047d'
         'cd552d92f2fb5b9d6c41c47da2d3b487'
        ) 



_prefix=/usr

build() {
    _svntrunk=http://streamboard.gmc.to/svn/oscam/trunk/
    _svnmod=OSCam

    cd ${srcdir}/
    if [ -d $_svnmod/.svn ]; then
        (cd $_svnmod && svn up -r $pkgver) || return 1
    else
        svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod || return 1
    fi
    msg "SVN checkout done or server timeout"
    msg "Starting make..."

    cp -r "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
    cd "$srcdir/$_svnmod-build"



    msg "Running make" 

    cmake -DCMAKE_INSTALL_PREFIX=${_prefix} \
    -DWEBIF=1 \
    -DCS_CONFDIR=/etc/oscam/ || return 1

    make || return 1

    make DESTDIR=${pkgdir} install

# mkdir -p ${pkgdir}/var/log/oscam/
mkdir -p ${pkgdir}/etc/oscam/

# Install rc-script
install -D -m755 ${srcdir}/rc-oscam ${pkgdir}/etc/rc.d/oscam || return 1

}